import datetime
import math
import os

import zhdate
from zhdate import ZhDate

now = datetime.datetime.now()
enumWeekend = {6: "日", 0: "一", 1: "二", 2: "三", 3: "四", 4: "无", 5: "六"}
周末 = 5 - now.weekday()
劳动节 = math.ceil((datetime.datetime(now.year, 5, 1).timestamp() - now.timestamp()) / 86400)
中秋节 = ZhDate(now.year, 8, 15).to_datetime().toordinal() - now.toordinal()
国庆节 = math.ceil((datetime.datetime(now.year, 10, 1).timestamp() - now.timestamp()) / 86400)
元旦 = math.ceil((datetime.datetime(now.year + 1, 1, 1).timestamp() - now.timestamp()) / 86400)
除夕 = ZhDate(now.year, 1, 1).to_datetime().toordinal() - now.toordinal()
端午节 = ZhDate(now.year, 5, 5).to_datetime().toordinal() - now.toordinal()
if 除夕 <= -3 :
    除夕 = ZhDate(now.year+1, 1, 1).to_datetime().toordinal() - now.toordinal()
strBase = f"今天是{now.year}年{now.month}月{now.day}日，{zhdate.ZhDate.from_datetime(now)}，星期{enumWeekend[now.weekday()]}，大家"
if now.hour < 9:
    strBase += """早上"""
elif now.hour < 12:
    strBase += """上午"""
elif now.hour < 13:
    strBase += """中午"""
elif now.hour < 18:
    strBase += """下午"""
elif now.hour < 24:
    strBase += """晚上"""

strBase += f"""好，工作再累，一定不要忘记摸鱼哦！有事没事起身去茶水间，去厕所，去廊道走走。别老在工位上坐着，上班是帮老板赚钱，摸鱼是赚老板的钱！"""
print(strBase)
# print(f"""距离周六还有""", 周末, "天")
# print(f"""劳动节已经过了 {abs(劳动)} 天""" if 劳动 < 0 else f"距离劳动节还有 {劳动} 天")
# print(f"""中秋已经过了 {abs(中秋)} 天""" if 中秋 < 0 else f"距离中秋节还有 {中秋} 天")
# print(f"""国庆已经过了 {abs(国庆)} 天""" if 国庆 < 0 else f"距离国庆节还有 {国庆} 天")
# print(f"""元旦已经过了 {abs(元旦)} 天""" if 元旦 < 0 else f"距离元旦还有 {元旦} 天")
# print(f"""除夕已经过了 {abs(除夕)} 天""" if 除夕 < 0 else f"距离除夕还有 {除夕} 天")

lst = {'周末': 周末,
       '劳动节': 劳动节,
       '中秋节': 中秋节,
       '国庆节': 国庆节,
       '元旦': 元旦,
       '端午节': 端午节,
       '除夕': 除夕}
his = []
for item in sorted(lst.items(), key=lambda s: s[1]):
    if item[1] >= 0:
        print(f"距离{item[0]}还有 {item[1]} 天")
    else:
        his.append(f"{item[0]}已经过了 {abs(item[1])} 天")
for item in his:
    print(item)

os.system("pause")